# $Id: PKGBUILD 176239 2013-01-28 00:11:44Z heftig $
# Maintainer: Jan Alexander Steffens (heftig) <jan.steffens@gmail.com>
# Contributor: Geoffroy Carrier <geoffroy.carrier@koon.fr>
# Contributor: congyiwu <congyiwu AT gmail DOT com>
pkgname=json-c
pkgver=0.10
pkgrel=2
pkgdesc="A JSON implementation in C"
url="https://github.com/json-c/json-c/wiki"
license=("MIT")
arch=('i686' 'x86_64')
depends=('glibc')
source=(https://github.com/downloads/$pkgname/$pkgname/$pkgname-$pkgver.tar.gz)
md5sums=('a4edc79410eb894f08d7d52ca9f88732')
options=(!libtool)
build() {
  cd $pkgname-$pkgver

  ## from http://pkgs.fedoraproject.org/cgit/json-c.git/tree/json-c.spec
  # Hack to get json_object_iterator.c compiled
  sed -e 's/json_object.c/json_object.c json_object_iterator.c/' \
      -e 's/json_object.h/json_object.h json_object_iterator.h/' \
      -e 's/json_object.lo/json_object.lo json_object_iterator.lo/' \
      -i Makefile.in

  ./configure --prefix=/usr --disable-static
  make
}

package() {
  cd $pkgname-$pkgver
  make DESTDIR="$pkgdir" install
  install -D COPYING "$pkgdir/usr/share/licenses/$pkgname/COPYING"
}
